package com.example.attack.controller;

import com.example.attack.model.ElCharacter;
import com.example.attack.service.ElCharacterService;
import com.example.attack.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/eventListener")
public class AttackController {

    @Autowired
    private ElCharacterService elCharacterService;

    @GetMapping("/commonAttack")
    public R attack(@RequestParam("id")Integer id){
        ElCharacter attackedObj = elCharacterService.commonAttack(id);
        return R.success("攻击成功", attackedObj);
    }

    @GetMapping("/physicalAttack")
    public R physicalAttack(@RequestParam("id")Integer id){
        ElCharacter attackedObj = elCharacterService.physicalAttack(id);
        return R.success("攻击成功", attackedObj);
    }

}
